<?php
 include("libfunc.php");
 
 $usr = $_POST['user'];
 $psw = $_POST['pass'];
 $psw = md5($psw);
 
 $link = koneksi_db();
 $sql = "SELECT * FROM admin WHERE username='$usr' AND userpsw='$psw'";
 $query = mysql_query($sql,$link);
 $f = mysql_fetch_array($query);
 $n = mysql_num_rows($query);
  
 if($n == 1){
  session_start();
  session_register('admUser');
  session_register('admPass');
  
   
  $_SESSION['admUser'] = $usr;
  $_SESSION['admPass'] = $psw;
  
  
  echo"<script language='javascript'>window.location = '../admin/adminIndex.php'</script>";
 }else{
  echo"<script language='javascript'>alert('Terjadi kesalahan, silakan ulangi !')</script>";
  echo"<script language='javascript'>window.location = '../admin'</script>";
 }
?>